package com.etc.user.controller;

import com.etc.entity.Area;

import com.etc.result.CodeMsg;
import com.etc.result.Result;
import com.etc.service.impl.AreaServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 文件名:com.etc.user.controller.AreaController
 * 描述：地区控制器
 * 作者:吴仕泉
 * 时间:2019/5/26 16:23
 */
@Controller
@RequestMapping("area.action")
public class AreaController {

    @Autowired
    AreaServiceImpl areaService;

    //查询中国省份信息
    @RequestMapping("findAreaByCityNum")
    @ResponseBody
    public Result<Area> findAreaByCityNum(Integer cityNum){
        List<Area> areas =  areaService.findAreasByCityNum(cityNum);
        if(areas == null){
            return Result.error(CodeMsg.REQUEST_ILLEGAL);
        }
        return Result.success(areas);
    }


}
